package com.wanyang.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Collections;
import java.util.List;

/**
 * 租房
 */
@Data
public class PostPublishRental extends PostPublishBase {
    private Rental rental;

    @Data
    public static class Rental {
        @ApiModelProperty(value = "1-求租，2-出租")
        private Integer type;
        @ApiModelProperty(value = "求组 - 房屋要求")
        private String askForRentDetail;
        @ApiModelProperty(value = "求组 - 联系人")
        private String askForRentContact;
        @ApiModelProperty(value = "求组 - 联系电话")
        private String askForRentMobile;

        @ApiModelProperty(value = "出租 - 房屋描述")
        private String rentOutDetail;
        @ApiModelProperty(value = "出租 - 房屋描述中的所有图片")
        private List<String> imgList;
        @ApiModelProperty(value = "出租 - 联系人")
        private String rentOutContact;
        @ApiModelProperty(value = "出租 - 联系电话")
        private String rentOutMobile;
        @ApiModelProperty(value = "出租 - 位置经度")
        private String rentOutLongitude;
        @ApiModelProperty(value = "出租 - 位置纬度")
        private String rentOutLatitude;
    }

    @Override
    public Object getDetailObject() {
        return rental;
    }

    @Override
    public AuditObject getNeedAuditObject() {
        AuditObject auditObject = new AuditObject();
        auditObject.setContents(rental.type == 1 ?
                Collections.singletonList(rental.askForRentContact) : Collections.singletonList(rental.rentOutDetail));
        auditObject.setImgList(rental.imgList);

        return auditObject;
    }
}
